﻿#ifndef GAME_H
#define GAME_H

#include <QWidget>
#include<QIcon>
#include"Resource.h"
#include<qmap.h>
class GameStart;
class Checkpoint;
class Entity;
class Game : public QWidget
{
    Q_OBJECT
public:
    //enum Process//流程
    //{

    //};
    explicit Game(QWidget *parent = nullptr);
    ~Game();
    //运行游戏
    void run();
    //初始化游戏
    void initGame(int w,int h,const QString&title,const QIcon& = QIcon());
    //加载资源
    void LoadingResources();
    //清理游戏
    void cleanGame();
    //更新游戏
    void updateGame();
    //绘制游戏
    void drawGame(QPainter* painter);
    //获取资源
    static Resource& res();
public slots:
    //开始界面
    void CreateGameStart();
    //单人关卡
    void CreateOnPlayerLevel();
    //网络模式
    void CreateNetworkModel();
    //结束界面
    void CreateGameOver(const int score);
    
protected:
    void paintEvent(QPaintEvent*ev)override;
    void closeEvent(QCloseEvent*ev)override;
    void keyPressEvent(QKeyEvent*ev)override;
    void keyReleaseEvent(QKeyEvent*ev)override;
private:
    static Resource* m_Res;
    Entity* m_game=nullptr;
};
#endif // GAME_H
